import {hasPermission} from '@/utils/hasPermission'

export const permission = {
    mounted(el: HTMLButtonElement, binding, vnode) {
        const {action, effect} = binding.value
        // console.log(vnode.ref.i.ctx.hasPermission(action), '虚拟')
        if (!hasPermission(action)) {
            if (effect == 'disabled') {
                el.disabled = true
                el.setAttribute('title', '没有权限')
            } else {
                el.remove()
            }
            console.log(action, effect)
        }
    }
}
